<div class="title">  
  <div class="left">
    企业员工
  </div>  
  <div class="right">
    <%= link_to '增加', new_employee_user_url(current_user), :method => :get, :remote => true, :class => 'crud new' if current_user.is_admin? %>
  </div>
</div>
<% current_user.enterprise.users.each do |user|  %>
<div class='grid_15 alpha omega employee <%= cycle '','h' %> <%= user.status %>'>
  <div class='grid_2 alpha logo'>          
    <%= image_tag "users/#{user.sex}.png", :size => '54x54' %>
    <% if user.is_admin? %>
    <div class='admin'>
      <%= link_to_function '管理员','',:title => '管理员' %>            
    </div>
    <% else %>
    <div class='status <%= user.status %>'>
      <%= link_to_function t(user.status),'',:title => t(user.status) %>
    </div>
    <% end %>
  </div>
  <div class='grid_5 detail'>
    <div class='name'>
      <%= user.full_name %>
    </div>    
    <div class='mobile'>
      <%= user.mobile %>
    </div>
    <div class='email'>
      <%= link_to user.email,"mailto:#{user.email}" %>
    </div>
    <div class='address'>
      <%= user.address %>
    </div>
  </div>
  <div class='grid_6 detail'>
    <%if user.groups.present?%>
       <div class='employee_title'>
        隶属组
      </div>
      <%user.groups.each do |group|%>
        <div class='group_name'>
          <%= group.name%>
        </div>
      <%end%>
    <%else%>
    &nbsp;
    <% end %>
  </div>
  <% if current_user.is_admin? and (not user.is_admin?) %>
  <div class='grid_2 omega tools'>
    <%= link_to "编辑资料",edit_employee_user_url(user), :remote => true, :method => :get,:title => '编辑员工基本资料', :class => 'tool' %>
    <%= link_to "重设密码",reset_employee_password_user_url(user), :remote => true, :method => :put, :title => '重设密码' , :class => 'tool' %>
    <%  if user.status.active? %>
    <%= link_to "锁定账户",lock_employee_user_url(user),:remote => true, :method => :put, :title => '锁定该员工账户，令其无法登录', :class => 'tool' %>
    <% else %>
    <%= link_to "激活账户",active_employee_user_url(user),:remote => true, :method => :put, :title => '激活该员工账户，允许其登录系统', :class => 'tool' %>
    <% end %>
  </div>
  <% end %>
</div>
<% end %>